/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author lomanda
 */
@Entity
@Table(name = "stock")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Stock.findAll", query = "SELECT s FROM Stock s"),
    @NamedQuery(name = "Stock.findByIdStock", query = "SELECT s FROM Stock s WHERE s.idStock = :idStock"),
    @NamedQuery(name = "Stock.findByDescricaoStock", query = "SELECT s FROM Stock s WHERE s.descricaoStock = :descricaoStock"),
    @NamedQuery(name = "Stock.findByTipoStock", query = "SELECT s FROM Stock s WHERE s.tipoStock = :tipoStock"),
    @NamedQuery(name = "Stock.findByQuantidade", query = "SELECT s FROM Stock s WHERE s.quantidade = :quantidade"),
    @NamedQuery(name = "Stock.findByData", query = "SELECT s FROM Stock s WHERE s.data = :data"),
    @NamedQuery(name = "Stock.findByStockMinimo", query = "SELECT s FROM Stock s WHERE s.stockMinimo = :stockMinimo")})
public class Stock implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "data")
    @Temporal(TemporalType.TIMESTAMP)
    private Date data;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idStock")
    private Integer idStock;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "descricao_Stock")
    private String descricaoStock;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "tipo_Stock")
    private String tipoStock;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "quantidade")
    private String quantidade;
    @Column(name = "stock_minimo")
    private Integer stockMinimo;
    @JoinColumn(name = "fkMaterial", referencedColumnName = "idMaterial")
    @ManyToOne(optional = false)
    private Material fkMaterial;

    public Stock() {
    }

    public Stock(Integer idStock) {
        this.idStock = idStock;
    }

    public Stock(Integer idStock, String descricaoStock, String tipoStock, String quantidade, Date data) {
        this.idStock = idStock;
        this.descricaoStock = descricaoStock;
        this.tipoStock = tipoStock;
        this.quantidade = quantidade;
        this.data = data;
    }

    public Integer getIdStock() {
        return idStock;
    }

    public void setIdStock(Integer idStock) {
        this.idStock = idStock;
    }

    public String getDescricaoStock() {
        return descricaoStock;
    }

    public void setDescricaoStock(String descricaoStock) {
        this.descricaoStock = descricaoStock;
    }

    public String getTipoStock() {
        return tipoStock;
    }

    public void setTipoStock(String tipoStock) {
        this.tipoStock = tipoStock;
    }

    public String getQuantidade() {
        return quantidade;
    }

    public void setQuantidade(String quantidade) {
        this.quantidade = quantidade;
    }

    public Integer getStockMinimo() {
        return stockMinimo;
    }

    public void setStockMinimo(Integer stockMinimo) {
        this.stockMinimo = stockMinimo;
    }

    public Material getFkMaterial() {
        return fkMaterial;
    }

    public void setFkMaterial(Material fkMaterial) {
        this.fkMaterial = fkMaterial;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idStock != null ? idStock.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Stock)) {
            return false;
        }
        Stock other = (Stock) object;
        if ((this.idStock == null && other.idStock != null) || (this.idStock != null && !this.idStock.equals(other.idStock))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Stock[ idStock=" + idStock + " ]";
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }
    
}
